package jsondemo1;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class jackdemo1 {
    public static void main(String[] args) throws JsonProcessingException {
        ObjectMapper objectMapper = new ObjectMapper();
        Person person = new Person("杨通通",12);
        String str = objectMapper.writeValueAsString(person);
        System.out.println(person);
        System.out.println(str);
        Person person1 = objectMapper.readValue(str, Person.class);
        System.out.println(person1);
    }
}
